#ifndef COMMON_H
#define COMMON_H

#include <boost/exception/all.hpp>
#include <boost/thread/shared_mutex.hpp>
#include <boost/thread/locks.hpp>

struct aborted_tx : virtual boost::exception {};

#ifdef _DEBUG
#define LOGV(fmt, ...)  printf(fmt "\n", ##__VA_ARGS__)
#define LOGD(fmt, ...)  printf(fmt "\n", ##__VA_ARGS__)
#define LOGE(fmt, ...)  printf(fmt "\n", ##__VA_ARGS__)
#else
#define LOGV
#define LOGD
#define LOGE
#endif

typedef boost::shared_lock<boost::shared_mutex> read_lock_t;
typedef boost::upgrade_lock<boost::shared_mutex> upgrade_lock_t;
typedef boost::unique_lock<boost::shared_mutex> write_lock_t;

#endif // COMMON_H
